/**
 * @file InnovativeTeaching.vue
 * @description 创新教学模式主页面
 * @created 2024-03-20
 */

<template>
  <div class="innovative-teaching">
    <!-- 如果是主页面显示卡片，如果是子路由则显示对应组件 -->
    <template v-if="!isSubRoute">
      <div class="page-header">
        <h2>创新教学模式</h2>
      </div>

      <!-- 功能卡片区 -->
      <div class="feature-grid">
        <div class="feature-card" 
             v-for="feature in features" 
             :key="feature.id"
             @click="navigateToFeature(feature.route)">
          <div class="feature-icon">{{ feature.icon }}</div>
          <h3>{{ feature.title }}</h3>
          <p>{{ feature.description }}</p>
          <div class="feature-stats">
            <div class="stat" v-for="stat in feature.stats" :key="stat.label">
              <div class="stat-value">{{ stat.value }}</div>
              <div class="stat-label">{{ stat.label }}</div>
            </div>
          </div>
        </div>
      </div>
    </template>
    
    <!-- 子路由视图 -->
    <router-view v-else></router-view>
  </div>
</template>

<script setup>
import { ref, computed } from 'vue'
import { useRouter, useRoute } from 'vue-router'

const router = useRouter()
const route = useRoute()

// 判断是否为子路由
const isSubRoute = computed(() => {
  return route.path !== '/innovative-teaching'
})

// 功能特性数据
const features = ref([
  {
    id: 1,
    icon: '🤖',
    title: '智能教学助手',
    description: 'AI驱动的智能备课、答疑和教学辅助',
    route: '/innovative-teaching/ai-assistant',
    stats: [
      { label: '答疑准确率', value: '95%' },
      { label: '教学效率', value: '↑50%' }
    ]
  },
  {
    id: 2,
    icon: '👥',
    title: '智能协作学习',
    description: 'AI驱动的小组协作与互动学习',
    route: '/innovative-teaching/collaborative',
    stats: [
      { label: '参与度', value: '92%' },
      { label: '协作效率', value: '↑60%' }
    ]
  },
  {
    id: 3,
    icon: '🎯',
    title: '项目式学习',
    description: '基于真实项目的实践学习模式',
    route: '/innovative-teaching/project-based',
    stats: [
      { label: '项目数量', value: '100+' },
      { label: '实践技能', value: '↑75%' }
    ]
  },
  {
    id: 4,
    icon: '📊',
    title: '多维度评价',
    description: '全方位的学习表现评估体系',
    route: '/innovative-teaching/evaluation',
    stats: [
      { label: '评价维度', value: '12+' },
      { label: '准确率', value: '96%' }
    ]
  }
])

// 导航到具体功能页面
const navigateToFeature = (route) => {
  router.push(route)
}
</script>

<style scoped>
.innovative-teaching {
  padding: 24px;
}

.page-header {
  margin-bottom: 24px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.feature-icon {
  font-size: 36px;
  margin-bottom: 16px;
}

.feature-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #f0f0f0;
}

.stat-value {
  font-size: 20px;
  font-weight: bold;
  color: #1890ff;
}

.stat-label {
  font-size: 14px;
  color: #666;
}
</style> 